package com.typhoon.spring_jdbctemplate.service.impl;

import com.typhoon.spring_jdbctemplate.dao.TaskDao;
import com.typhoon.spring_jdbctemplate.dao.support.PageQuery;
import com.typhoon.spring_jdbctemplate.dao.support.PageResult;
import com.typhoon.spring_jdbctemplate.entity.Task;
import com.typhoon.spring_jdbctemplate.service.TaskService;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service("taskService")
public class TaskServiceImpl implements TaskService {

    private TaskDao taskDao = new TaskDao();

    @Override
    public PageResult<Task> page(PageQuery pageQuery, Map<String, Object> params) {
        return this.taskDao.page(pageQuery,params);
    }

    @Override
    public int update(Task task) {
        return this.taskDao.update(task);
    }

    @Override
    public int insert(Task task) {
        return this.taskDao.insert(task);
    }

    @Override
    public void doAssign(Task task) {
        if(null == task) {
            return ;
        }
        task.setStatus(3);
        this.update(task);
    }
}
